
gui_src = {}

function gui_src.net_config_display()
    local disp = gui_mgr.get_disp()

    disp:drawUTF8(40, 5, "wifi")
    if wifi_mgr.ip ~= nil then
        disp:drawUTF8(0, 20, "ip:"..wifi_mgr.ip)
    else
        disp:drawUTF8(0, 20, "ip:".."getting...")
    end
    --[[ 
    if wifi_mgr.nm ~= nil then
        disp:drawUTF8(0, 14, "nm:"..wifi_mgr.nm)
    else
        disp:drawUTF8(0, 14, "nm:".."getting...")
    end
    --]]
    if wifi_mgr.gw ~= nil then
        disp:drawUTF8(0, 35, "gw:"..wifi_mgr.gw)
    else
        disp:drawUTF8(0, 35, "gw:".."getting...")
    end
    --[[ 
    if wifi_mgr.mac ~= nil then
        disp:drawUTF8(0, 42, wifi_mgr.mac)
    else
        disp:drawUTF8(0, 42, "mac:".."getting...")
    end
    --]]
end

function gui_src.weather_display()
    local disp = gui_mgr.get_disp()
    local str1 = "--------"
    local weat_map = {["晴"] = "sunny",["阴"] = "cloudy",["多云"] = "cloudy",["雨"] = "cloudy",}
    local ymd, hms = ntp.get_tim_str2()
    local t, h, we, wind = json.weather["temperature"], 
            json.weather["humidity"], json.weather["text"],
            json.weather["wind_speed"]
    if h ~=nil and t ~=nil then
        str1 = t.."度".." "..h.."%".." "..weat_map[we]
    end
    --if we ~=nil and wind ~=nil then
    --    str2 = "风力:"..wind
    --end
    disp:drawUTF8(10, 5, str1)

    if ymd ~= nil then
        disp:drawUTF8(20, 45, ymd)
    else
        disp:drawUTF8(20, 45, "----")
    end
    if hms ~= nil then
        disp:drawUTF8(30, 25, hms)
    else
        disp:drawUTF8(30, 25, "----")
    end
end

return gui_src